/*
 *  AudioEngineIPhone.h
 *  SypXIPhone
 *
 *  Created by Luv Khemani on 7/24/10.
 *  Copyright 2010 Luv Khemani. All rights reserved.
 *
 */

#pragma once
#ifndef SYPX_AUDIOENGINEIPHONE
#define SYPX_AUDIOENGINEIPHONE

#include "Base.h"
#include "AudioEngineOAL.h"
#import <AVFoundation/AVFoundation.h>


namespace SypX
{
	class AudioEngineIPhone : public AudioEngineOAL
	{
	public:
		AudioEngineIPhone(void);
		virtual ~AudioEngineIPhone(void);
		///Plays a background music file (Only works on iPhone for now)
		///Due to hardware constraints on iPhone, only 1 background music can be played by hardware
		///All sound effects should use SoundBuffers and playSound
		void playMusic(const String& file, bool loop = true);
		///Stops currently playing Music and resets the timeline to beginning
		virtual void stopMusic();
		///Handles audio Interruption(phonecall, alarm clock,etc..)
		void handleInterruption();
		void endInterruption();
	private:
		//Music PLayback
		AVAudioPlayer *audioPlayer;
		///Store OpenAL context here during interruptions
		ALCcontext* context;

		
	};
}
#endif